<script>
    function vesA(id){
        window.location="selcreateItem?reftype=" + id.value;
    }
    function vesASub(id){
        window.location="selcreateItem?refsubtype=" + id.value;
    }
</script>    

<!-- BEGIN CONTEINER -->
<div id="content">
    <div id="title">
        <div class="left"><fmt:message key="createitem"/></div>
        <div class="sp"></div>
    </div>
    <table cellpadding="7">
        <tbody align="left">
        <form id="form1" method="post" action="<c:url value='/createProd'/>">	
            <tr>
                <td><fmt:message key="type"/>:</td>
                <td><select id="Tipus_producte" name="Tipus_producte" onchange="vesA(this)">
                        <c:forEach var="type" items="${types}"  varStatus="iter">              
                            <option value="${type.idtypeProduit}" ${(iter.index == selectedType) ? 'selected' : ' '}>${type.typeProduit}</option>
                        </c:forEach>
                    </select>
                </td>

                <td><fmt:message key="subtype"/>:</td>

                <td> <select id="tipus" name="Subtipus_producte" onchange="vesASub(this)">
                        <c:forEach var="subtype" items="${subtypes.get(selectedType)}"   varStatus="iter">
                            <option value="${subtype.idtypeProduit}" ${(iter.index == selectedSubType) ? 'selected' : ' '}>${subtype.typeProduit}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>       	
            <tr>      
                <td> <label for="tipDesSort_sp"><fmt:message key="nomp"/>: </label>
                </td>
                <td> <input type="text" value="" id="tipDesSort" name="tipDesSort_sp" size="20" maxlength="33"/>
                </td>
                <td><label for="tags"><fmt:message key="tags"/>:</label></td><td><input type="text" value="" id="tags" name="tags" size="30" maxlength="200"/></td>





            </tr> 
            <tr>
                <td><label for="tipDesLong"><fmt:message key="description"/>: </label></td><td> <textarea id="tipDesLong" name="tipDesLong" rows="6" cols="28"></textarea></td>
            </tr>
            <tr>

                <td><label for="preu"><fmt:message key="price"/>:</label></td><td><input type="text" value="0.0" id="preu" name="preu" size="4" maxlength="6"/></td>

                <td><label for="remise"><fmt:message key="remise"/>:</label></td><td><input type="text" value="0" id="remise" name="remise" size="4" maxlength="2" onkeyup="this.value=validarSiNumero(this.value);"/></td>
            </tr><tr>
                <td><label for="st_ini"><fmt:message key="stoci"/>:</label></td><td><input type="text" value="0" id="st_ini" name="st_ini" size="4" maxlength="6" onkeyup="this.value=validarSiNumero(this.value);"/></td>

                <td><label for="st_act"><fmt:message key="stoca"/>:</label></td><td><input type="text" value="0" id="st_act" name="st_act" size="4" maxlength="6" onkeyup="this.value=validarSiNumero(this.value);"/></td>
            </tr><tr>
                <td><label for="st_notif"><fmt:message key="stocm"/>:</label></td><td><input type="text" value="0" id="st_notif" name="st_notif" size="4" maxlength="6" onkeyup="this.value=validarSiNumero(this.value);"/></td>
            </tr><tr>
                <td><label for="st_notif"><fmt:message key="image"/>:</label></td><td><input type="file" id="pic" name="pic" accept="image/jpeg" onchange="updatePhoto(this)"/></td>
            </tr>
            </tbody>
    </table>
    <div class="botons">
        <input type="submit" name="save" value="<fmt:message key="save"/>"/>
    </div>
</div>
</form>
</div>
<!-- END CONTENT -->
<div class="sp"></div>
</div>
<div class="sp"></div>
</div>